import Router from 'vue-router'
Vue.use(Router)


// 解决编程式路由往同一地址跳转时会报错的情况
const originalPush = Router.prototype.push;
const originalReplace = Router.prototype.replace;

// push
Router.prototype.push = function push(location, onResolve, onReject) {
  if (onResolve || onReject)
    return originalPush.call(this, location, onResolve, onReject);
  return originalPush.call(this, location).catch(err => err);
};

//replace
Router.prototype.replace = function push(location, onResolve, onReject) {
  if (onResolve || onReject)
    return originalReplace.call(this, location, onResolve, onReject);
  return originalReplace.call(this, location).catch(err => err);
};


export default new Router({
	mode: 'history',
	// base: '/plat',

	routes: [
    {
      path: '/',
      redirect:'/index'
    },

    {
        path: '/index',
        component: () => import('@/kaoshi/index'),
        mete:{
          title:"首页",
        }
    },
    {
        path: '/zhuce',
        component: () => import('@/kaoshi/zhuce'),
        mete:{
          title:"注册",
        }
    },
    {
        path: '/denglu',
        component: () => import('@/kaoshi/denglu'),
        mete:{
          title:"登录",
        }
    },
    {
        path: '/zhaohuimima',
        component: () => import('@/kaoshi/denglu/zhaohuimima'),
        mete:{
          title:"找回密码",
        }
    },
    {
        path: '/chongzhimima',
        component: () => import('@/kaoshi/denglu/chongzhimima'),
        mete:{
          title:"重置密码",
        }
    },

    {
    	path: '/gerenzhongxin',
      component: () => import('@/kaoshi/gerenzhongxin/index'),
      mete:{
        title:"个人中心",
      }
      // redirect:'/gerenzhongxin/gerenzhongxin',
      // children:[
      //   {
      //     path: '/gerenzhongxin/gerenzhongxin',
      //     component: () => import('@/kaoshi/gerenzhongxin/gerenxinxi'),
      //     mete:{
      //       title:"个人中心",
      //     },
      //   },
      //   {
      //     path: '/gerenzhongxin/kaochangxinxi',
      //     component: () => import('@/kaoshi/gerenzhongxin/kaochangxinxi'),
      //     mete:{
      //       title:"考场信息",
      //     },
      //   },
      //   {
      //     path: '/gerenzhongxin/kaoguanxinxi',
      //     component: () => import('@/kaoshi/gerenzhongxin/kaoguanxinxi'),
      //     mete:{
      //       title:"考官信息",
      //     },
      //   },
      // ]
    },


    {
    	path: '/kaoshi',
      component: () => import('@/kaoshi/kaoshiguanli/index'),
      redirect:'/kaoshi/kaoshiguanli',
      children:[
        {
          path: '/kaoshi/kaoshiguanli',
          component: () => import('@/kaoshi/kaoshiguanli/list'),
          mete:{
            title:"考试管理",
          },
        },
        // {
        //   path: '/kaoshi/kaoshiguanli/add',
        //   component: () => import('@/kaoshi/kaoshiguanli/add'),
        //   mete:{
        //     title:"添加考试",
        //   },
        // },
      ]
    },

    {
    	path: '/kaochang',
      component: () => import('@/kaoshi/kaochangguanli/index'),
      redirect:'/kaochang/kaochangguanli',
      children:[
        {
          path: '/kaochang/kaochangguanli',
          component: () => import('@/kaoshi/kaochangguanli/list'),
          mete:{
            title:"考场管理",
          },
        },
        {
          path: '/kaochang/detail',
          component: () => import('@/kaoshi/kaochangguanli/detail'),
          mete:{
            title:"考场详情",
          },
        }
      ]
    },

    {
    	path: '/kaoguan',
      component: () => import('@/kaoshi/kaoguanguanli/index'),
      redirect:'/kaoguan/kaoguanguanli',
      children:[
        {
          path: '/kaoguan/kaoguanguanli',
          component: () => import('@/kaoshi/kaoguanguanli/list'),
          mete:{
            title:"考官列表",
          },
        },
        {
          path: '/kaoguan/detail',
          component: () => import('@/kaoshi/kaoguanguanli/detail'),
          mete:{
            title:"考官详情",
          },
        }
      ]
    },
    {
    	path: '/xinwen',
      component: () => import('@/kaoshi/xinwen/index'),
      redirect:'/xinwen/xinwen',
      children:[
        {
          path: '/xinwen/xinwen',
          component: () => import('@/kaoshi/xinwen/list'),
          mete:{
            title:"新闻列表",
          },
        },
        {
          path: '/xinwen/detail',
          component: () => import('@/kaoshi/xinwen/detail'),
          mete:{
            title:"新闻详情",
          },
        }
      ]
    },
    
    {
    	path: '/guanyuwomen',
      component: () => import('@/kaoshi/guanyuwomen/index'),
      redirect:'/guanyuwomen/guanyuwomen',
      children:[
        {
          path: '/guanyuwomen/guanyuwomen',
          component: () => import('@/kaoshi/guanyuwomen/list'),
          mete:{
            title:"关于我们",
          },
        },

      ]
    },
    
	]
})
